package com.blqy.fr.user.api;

import cn.hutool.jwt.Claims;
import com.alibaba.fastjson.JSON;
import com.blqy.fr.common.constant.RedisConstant;
import com.blqy.fr.common.execption.BlQyException;
import com.blqy.fr.common.result.Result;
import com.blqy.fr.common.util.AuthContextHolder;
import com.blqy.fr.model.user.Team;
import com.blqy.fr.user.service.TeamInfoService;
import com.blqy.fr.vo.team.TeamDetailVo;
import com.blqy.fr.vo.team.TeamVo;
import com.blqy.fr.vo.user.UserVo;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import com.blqy.fr.common.result.ResultCodeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import static javax.crypto.Cipher.SECRET_KEY;

@Tag(name = "团队信息接口")
@RestController
@Slf4j
@RequestMapping("/api/team/info")
public class TeamInfoController {

    @Autowired
    private TeamInfoService teamInfoService;

    //创建团队
    @GetMapping("/createTeam")
    public Result<TeamVo> createTeam(){
        TeamVo teamVo = teamInfoService.getOrCreateDefaultTeam();
        return Result.ok(teamVo);
    }

    //查询当前团队信息
    @GetMapping("/findMyTeam")
    public Result<TeamDetailVo> findMyTeam(){
        TeamDetailVo teamVo = teamInfoService.findMyTeam();
        return Result.ok(teamVo);
    }

}
